#ifndef VECTOR_H
#define VECTOR_H

#include <iostream>
#include <QDataStream>
#include <QDebug>

typedef enum{
    LINEVECTOR,
    COLUMNVECTOR
}TypeVector;

class Vector
{
    int nDim;

    float *data;

    TypeVector m_type;

    public:
        Vector(int dim = 1);
        Vector(const Vector& v);
        virtual ~Vector();

               float&    operator()(int idx);
        const float     operator()(int idx)const;

        Vector            operator+(const Vector&)const;
        Vector            operator-(const Vector&)const;
        Vector            operator-()const;
        float            operator*(const Vector&)const;
        Vector            operator*(float a)const;
        friend Vector    operator*(float a, const Vector&);
        Vector            operator/(float a)const;
        const  Vector&    operator=(const Vector&);
        friend std::ostream& operator<<(std::ostream& out, const Vector& v);
        friend QDataStream & operator<< ( QDataStream & out, const Vector& v );
        friend QDebug operator<<(QDebug dbg, const Vector &c);

        const int        dim()const;
               TypeVector type()const;
        const Vector&    transpose();
        float            length ();
        void             set(float *);
        void             set(float v = 0.0);
        void swap(int i, int j);

        static float dot(const Vector& v1, const Vector& v2);

};

#endif // VECTOR_H
